package application.translators.impl;

import application.model.AppliancesCompositionModel;
import application.model.AppliancesCompositionsModel;
import application.translators.Translator;
import mappings.AppliancesComposition;

import java.util.List;

public class AppliancesCompositionTranslator implements Translator<List<AppliancesComposition>, AppliancesCompositionsModel>
{
    @Override
    public AppliancesCompositionsModel translate(List<AppliancesComposition> input)
    {
        AppliancesCompositionsModel appliancesCompositionsModel = new AppliancesCompositionsModel();

        for(AppliancesComposition appliancesComposition : input)
        {
            AppliancesCompositionModel appliancesCompositionModel = new AppliancesCompositionModel();

            appliancesCompositionModel.setApplianceName(appliancesComposition.getAppliances().getName());
            appliancesCompositionModel.setStandardName(appliancesComposition.getStandards().getName());

            appliancesCompositionsModel.addApplianceComposition(appliancesCompositionModel);
        }

        return appliancesCompositionsModel;
    }
}
